
import sys

#RabbitMQ操作类
from RabbitUtil import RabbitUtil
#参数获取类
from Config      import *
from SpiderUtil import *


#使用RabbitMQ，插入省信息
def InsertProvince(ProvinceList):
    #获得配置参数
    RabbitParam = Config["RabbitMQ"];
    #初始化Rabbit
    RabbitH = RabbitUtil(host=RabbitParam["host"], user=RabbitParam["user"], passwd=RabbitParam["passwd"], vhost=RabbitParam["vhost"]);
    #创建省信息队列
    IP = "127.0.0.1".replace(".", "_");
    QueueName = Config["Spider"]["alilqName"]+IP
    RabbitH.CreateQueues([QueueName]);
    RabbitH.Produce(QueueName, ProvinceList);
    #end

#测试
import time
if __name__ == "__main__":
    #插入待获取省列表
    InsertProvince(["广东?30"]);

    # args = sys.argv
    # InsertProvince(args[1].split(","))

    # # 状态修改为进行中
    # StatusModify(Status=3)
    # # 次数+1
    # RunCountAdd()

    print("add prov success")
